package nl.rainbowsheep.reisorg.rest.service.service;

import nl.rainbowsheep.reisorg.rest.service.model.AccommodationType;
import nl.rainbowsheep.reisorg.rest.service.repository.AccommodationTypeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccommodationTypeService {

    @Autowired
    AccommodationTypeRepository accommodationtypeRepository;

    public AccommodationType findById(long id) {
        AccommodationType at = accommodationtypeRepository.findOne(id);
        return at;
    }

    /**
     * Checks if AccommodationType exists in database
     * @param at
     * @return 
     */
    public AccommodationType findByType(String at) {
        return accommodationtypeRepository.findByType(at);
    }
    
    public AccommodationType save(AccommodationType at) {
        return accommodationtypeRepository.save(at);
    }
}
